home *** CD-ROM | disk | FTP | other *** search
/ Super PC 35 / Super PC 35 (Shareware).iso / spc / WIN95 / CM95 / INTERNET.DLL / TEXT / WILPEGASUS < prev    next >
Encoding:
Text File  |  1996-03-20  |  1.9 KB  |  95 lines

  1. bOK = @TRUE
  2. szDial     = "<dialupname>"
  3. szPgmPath  = "<pgmpath>"
  4. szPgmDir   = "<pgmdir>"
  5. bGetMail   = <getmail>
  6. bSendMail  = <sendmail>
  7. bGetSend   = <getsend>
  8. szErrDesc  = ""
  9. nWait      = 1 ; How many minutes to wait for Agent to finish its work
  10.  
  11.  
  12. ;Dial our host (unless user is on a direct connect)...
  13. hConn = 0
  14. if (szDial <> "")
  15.     hConn = SDialUp (szDial)
  16.     nErr = SGetLastErr ()
  17.     if (!hConn)
  18.         switch nErr
  19.             case @SErrNotFound
  20.             szErrDesc = "Couldn't connect to %szDial% - no such dial-up"
  21.  
  22.             case nErr ; <--default
  23.             szErrDesc = "Couldn't connect to %szDial% - error %nErr%"
  24.         endswitch
  25.         bOK = @FALSE
  26.         goto LogIt
  27.     else
  28.         if (nErr == @SAlready)
  29.             hConn = 0
  30.         endif
  31.     endif
  32. endif
  33.  
  34.  
  35. ; Run Pegasus Mail & make it do things...
  36. szTitle = ""
  37. if (WinExist ("Pegasus Mail")) then szTitle = "Pegasus Mail"
  38. if (szTitle <> "")
  39.     WinActivate (szTitle)
  40. else
  41.     DirChange (szPgmDir)
  42.     Run (szPgmPath, "")
  43.     delay (6)
  44.     if (WinExist ("Pegasus Mail")) then szTitle = "Pegasus Mail"
  45. endif
  46.  
  47.  
  48. ; Check for new mail on server (if chosen)...
  49. if (bGetMail)
  50.     SendKeysTo (szTitle, "!fc")
  51.     Delay (10)
  52. endif
  53.  
  54. ; Send queued mail (if chosen)...
  55. if (bSendMail)
  56.     SendKeysTo (szTitle, "!fa")
  57.     Delay (10)
  58. endif
  59.  
  60. ; Get new mail and send mail (if chosen)...
  61. if (bGetSend)
  62.     SendKeysTo (szTitle, "!fh")
  63.     Delay (10)
  64. endif
  65.  
  66. ; Wait for nWait minutes, or till user kills off Pegasus Mail manually...
  67. for n=1 to nWait * 6
  68.     if (WinExist (szTitle))
  69.         Delay (10)
  70.     endif
  71. next n
  72.  
  73.  
  74. ; If user hit Ctrl+Break, WIL will bring us here...
  75. :Cancel
  76.  
  77. ; Hang up...
  78. :HangUp
  79. if (hConn)
  80.     nRet = SHangUp (hConn)
  81. endif
  82.  
  83.  
  84. ; Log what we did...
  85. :LogIt
  86. if bOK == @TRUE
  87.     szLog = "Ran Pegasus Mail"
  88. else
  89.     szLog = strcat ("Error attempting to automate Pegasus Mail:", @CRLF, szErrDesc)
  90. endif
  91.  
  92. CMLogMessage (szLog)
  93. exit
  94.  
  95.